<?php

namespace Database\Seeders;

use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class FollowersTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $users = User::all();
        $user = $users->first();
        $userId = $user->id;

        $followers = $users->slice($userId);
        $followerIds = $followers->pluck('id')->toArray();

        $user->follow($followerIds);

        foreach ($followers as $follower) {
            $follower->follow(1);
        }
    }
}
